$(function(){
    getComments();
});

function saveComment(form){
    $.ajax({
        type: "POST",
        url: url_saveComentario,
        data: form.serialize(),
        success: function(data) {
            $('#comments').append(data);
        },
        beforeSend: function() {
            $('#comment_loader').css('display', 'block');
        },
        complete: function(){
            $('#comment_loader').css('display', 'none');
        }
    });
}

function getComments(){
    $.ajax({
        type: "POST",
        url: url_getComentarios,
        success: function(data) {
            $('#comments_box').html(data);
        },
        complete: function(){
            $('#comments_loader').css('display', 'none');
        }
    });
}

